class Solution(object):
    def getMaxLen(self, nums):
        left = 0
        right = 0
        n = len(nums)
        now = []
        val = 1
        max_len = 0
        while right < n:
            if nums[right] == 0:
                left = right + 1
                now = []
            else:
                val *= nums[right]
                if val > 0:
                    max_len = max(max_len, right - left + 1)
                else:
                    if now:
                        max_len = max(max_len, right - now[0])
                    else:
                        now.append(right)
            right += 1
        return max_len


